package com.imooc.config;

import com.imooc.filter.TimeFilter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.List;

@ConfigurationProperties("urls")
@Configuration
public class FilterConfig {


    public List<String> anno;

    @Bean
    public FilterRegistrationBean timeFilter() {

        FilterRegistrationBean registrationBean = new FilterRegistrationBean();

        TimeFilter timeFilter = new TimeFilter();
        registrationBean.setFilter(timeFilter);
        registrationBean.setUrlPatterns(anno);

        return registrationBean;
    }

    public List<String> getAnno() {
        return anno;
    }

    public void setAnno(List<String> anno) {
        this.anno = anno;
    }
}
